<template>
	<view class="content">
		<view class="pay">
			<view class="pay_item" v-for="(item,index) in list" :key="index">
				<view class="pay_l">
					<view class="pay_title">充值成功</view>
					<view class="pay_time">{{item.createtime | formatDate}}</view>
				</view>
				<view class="pay_r">+{{item.money}}</view>
			</view>
			<!-- <view class="pay_item">
				<view class="pay_l">
					<view class="pay_title">微信充值成功</view>
					<view class="pay_time">2020.3.15 14:23:24</view>
				</view>
				<view class="pay_r">+200</view>
			</view>
			<view class="pay_item">
				<view class="pay_l">
					<view class="pay_title">支付宝充值失败</view>
					<view class="pay_time">2020.3.15 14:23:24</view>
				</view>
				<view class="pay_r pay_r1">+200</view>
			</view>
			<view class="pay_item">
				<view class="pay_l">
					<view class="pay_title">微信充值失败</view>
					<view class="pay_time">2020.3.15 14:23:24</view>
				</view>
				<view class="pay_r pay_r1">+200</view>
			</view>
			<view class="pay_item">
				<view class="pay_l">
					<view class="pay_title">支付宝充值中...</view>
					<view class="pay_time">2020.3.15 14:23:24</view>
				</view>
				<view class="pay_r pay_r2">+200</view>
			</view>
			<view class="pay_item">
				<view class="pay_l">
					<view class="pay_title">微信充值中...</view>
					<view class="pay_time">2020.3.15 14:23:24</view>
				</view>
				<view class="pay_r pay_r2">+200</view>
			</view> -->
			
			<view class="wu" v-if="list.length == 0">暂无数据~</view> 
		</view>
	</view>
</template>

<script>
import getdata from '@/common/ajax.js';		
	export default {
		data() {
			return {
				list:[]
			}
		},
		onLoad(){
			
			this.jilu()
		},
		methods: {
			jilu(){
				//获取提现列表
				uni.showLoading({
				    title: '加载中'
				});
				var _this = this
				var token = uni.getStorageSync('token')
				uni.request({
					url: getdata.websiteUrl + '/user/recharge_log',
					header:{'content-type': "application/x-www-form-urlencoded",token:token},
					dataType: 'json',
					method: 'POST',
					success: res => {
						uni.hideLoading();
						console.log(res,'list')
						if(res.data.code == 1){
							_this.list = res.data.data
						}else if(res.data.code == 401){
							getdata.shou('请登录')
							uni.reLaunch({
							    url: '../login/login'
							});
						}else{
							getdata.shou(res.data.msg)
						}
						
					},
					fail: res => {
						uni.hideLoading();
						getdata.shou('服务器断开链接')
					}
				});
			},
		},
		filters:{
			//过滤器，时间戳转时间
				formatDate: function(value) {
					var date = new Date();
					//date.setTime(value);
					var month = date.getMonth() + 1;
					var hours = date.getHours();
					if (hours < 10)
						hours = "0" + hours;
					var minutes = date.getMinutes();
					if (minutes < 10)
						minutes = "0" + minutes;
					var time = date.getFullYear() + "-" + month + "-" + date.getDate() +
						" " + hours + ":" + minutes;
					return time;
				}
				
		},
	}
</script>

<style lang="scss">
.wu{
	text-align: center;
	font-size: 30rpx;
	color: #8D8D97;
}	
.pay{
	width: 100%;
	box-sizing: border-box;
	padding: 30rpx;
	.pay_item{
		box-sizing: border-box;
		width: 690rpx;
		height: 200rpx;
		border: 2rpx solid #B1B5BE;
		border-radius: 20rpx;
		padding: 45rpx 44rpx 50rpx 36rpx;
		display: flex;
		justify-content: space-between;
		margin-bottom: 25rpx;
		.pay_l{
			.pay_title{
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #333333;
			}
			.pay_time{
				font-size: 26rpx;
				font-family: PingFang SC;
				color: #999999;
				margin-top: 44rpx;
			}
		}
		.pay_r{
			display: flex;
			font-size: 48rpx;
			font-family: PingFang SC;
			font-weight: 400;
			color: #EC295C;
			align-items: center;
		}
		.pay_r1{
			color: #999999;
		}
		.pay_r2{
			color: #FCB936;
		}
	}
}
</style>
